package com.fujitsu.nanjing.tieba.dao;

import com.fujitsu.nanjing.tieba.ibator.CoreReply;
import com.fujitsu.nanjing.tieba.ibator.CoreReplyCriteria;
import java.util.List;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class CoreReplyDAOImpl extends SqlMapClientDaoSupport implements CoreReplyDAO {

    public CoreReplyDAOImpl() {
        super();
    }

    public int countByExample(CoreReplyCriteria example) {
        Integer count = (Integer)  getSqlMapClientTemplate().queryForObject("core_reply.countByExample", example);
        return count;
    }

    public int deleteByExample(CoreReplyCriteria example) {
        int rows = getSqlMapClientTemplate().delete("core_reply.deleteByExample", example);
        return rows;
    }

    public int deleteByPrimaryKey(Integer replyid) {
        CoreReply _key = new CoreReply();
        _key.setReplyid(replyid);
        int rows = getSqlMapClientTemplate().delete("core_reply.deleteByPrimaryKey", _key);
        return rows;
    }

    public void insert(CoreReply record) {
        getSqlMapClientTemplate().insert("core_reply.insert", record);
    }

    public void insertSelective(CoreReply record) {
        getSqlMapClientTemplate().insert("core_reply.insertSelective", record);
    }

    @SuppressWarnings("unchecked")
    public List<CoreReply> selectByExampleWithBLOBs(CoreReplyCriteria example) {
        List<CoreReply> list = getSqlMapClientTemplate().queryForList("core_reply.selectByExampleWithBLOBs", example);
        return list;
    }

    @SuppressWarnings("unchecked")
    public List<CoreReply> selectByExampleWithoutBLOBs(CoreReplyCriteria example) {
        List<CoreReply> list = getSqlMapClientTemplate().queryForList("core_reply.selectByExample", example);
        return list;
    }

    public CoreReply selectByPrimaryKey(Integer replyid) {
        CoreReply _key = new CoreReply();
        _key.setReplyid(replyid);
        CoreReply record = (CoreReply) getSqlMapClientTemplate().queryForObject("core_reply.selectByPrimaryKey", _key);
        return record;
    }

    public int updateByExampleSelective(CoreReply record, CoreReplyCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_reply.updateByExampleSelective", parms);
        return rows;
    }

    public int updateByExampleWithBLOBs(CoreReply record, CoreReplyCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_reply.updateByExampleWithBLOBs", parms);
        return rows;
    }

    public int updateByExampleWithoutBLOBs(CoreReply record, CoreReplyCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_reply.updateByExample", parms);
        return rows;
    }

    public int updateByPrimaryKeySelective(CoreReply record) {
        int rows = getSqlMapClientTemplate().update("core_reply.updateByPrimaryKeySelective", record);
        return rows;
    }

    public int updateByPrimaryKeyWithBLOBs(CoreReply record) {
        int rows = getSqlMapClientTemplate().update("core_reply.updateByPrimaryKeyWithBLOBs", record);
        return rows;
    }

    public int updateByPrimaryKeyWithoutBLOBs(CoreReply record) {
        int rows = getSqlMapClientTemplate().update("core_reply.updateByPrimaryKey", record);
        return rows;
    }

    protected static class UpdateByExampleParms extends CoreReplyCriteria {
        private Object record;

        public UpdateByExampleParms(Object record, CoreReplyCriteria example) {
            super(example);
            this.record = record;
        }

        public Object getRecord() {
            return record;
        }
    }
}